package config

import (
	"fmt"
	"github.com/spf13/viper"
)

type ViperStruct struct {
	Mysql struct {
		Dialect string
		Dsn     string
	}
	Redis struct {
		Addr     string
		Password string
		DB       int
	}
}

var Data ViperStruct

func ViperDataFs() {

	viper.SetConfigFile("../config/config.yaml")
	err := viper.ReadInConfig()
	if err != nil {
		panic("读取失败")
	}
	err = viper.Unmarshal(&Data)
	if err != nil {
		panic("转json失败")
	}

	fmt.Println(Data)

}
